package keqiang.com.kq_flutter_widgets_example;

import android.content.res.Configuration;

import com.keqiang.base.GlobalParamUtils;

import androidx.annotation.NonNull;
import io.flutter.app.FlutterApplication;
import me.zhouzhuo810.magpiex.utils.BaseUtil;
import me.zhouzhuo810.magpiex.utils.LanguageUtil;
import me.zhouzhuo810.magpiex.utils.ScreenAdapterUtil;
import me.zhouzhuo810.magpiex.utils.SimpleUtil;

/**
 * @author zhouzhuo810
 * @date 2023/2/20 20:14
 */
public class MainApp extends FlutterApplication {
    
    @Override
    public void onCreate() {
        super.onCreate();
        
        BaseUtil.init(this);
    
        //顺便初始化屏幕适配工具类
        ScreenAdapterUtil.init(this);
    
        initBaseLib();
    }
    
    @Override
    public void onConfigurationChanged(@NonNull Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        SimpleUtil.resetScale(this);
    }
    
    /**
     * 初始化基础库
     */
    private void initBaseLib() {
        // 对Base库初始化
        GlobalParamUtils.initApplication(this,
            BuildConfig.DEBUG,
            BuildConfig.PROVIDER_AUTHORITIES,
            getExternalCacheDir().getAbsolutePath());
    }
    
}
